package com.woniu.mealsService.controller;


import cn.hutool.core.bean.BeanUtil;
import com.github.pagehelper.PageInfo;
import com.woniu.dto.SelectProductByStoreIdDTO;
import com.woniu.form.PageForm;
import com.woniu.mealsService.service.ProductService;
import com.woniu.param.PageParam;
import com.woniu.utils.JwtUtil;

import com.woniu.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 菜品表 前端控制器
 * </p>
 *
 * @author 吕雨泽
 * @since 2024年12月06日
 */
@RestController
@RequestMapping("/product")
//@Api(tags = "菜品管理")
public class ProductController {
//    @Autowired
//    private ProductService productService;
//    @ApiOperation(value = "根据商家id查询菜品")
//    @ApiImplicitParam(value = "商家token", name = "token")
//    @PostMapping("/searchProductByStoreId")
//    public Result searchProductByStoreId(@RequestHeader String token, PageForm pageForm) throws Exception {
//        // 获取商家id
//        //String userId = JwtUtil.parseToken(token).get("userId").toString();
//        //假设有接口可以通过商家id获取店铺id
//        String storeId="1";
//        PageInfo<SelectProductByStoreIdDTO> pageInfo=productService.searchProductByStoreId(storeId, BeanUtil.toBean(pageForm, PageParam.class));
//        return Result.getResult(PageInfo.class).setCode(200).setMsg("查询成功").setData(pageInfo);
//    }
//    @ApiOperation(value = "根据id删除菜品")
//    @ApiImplicitParams({
//            @ApiImplicitParam(value = "商家token", name = "token"),
//            @ApiImplicitParam(value = "菜品id", name = "productId")
//    })
//    @DeleteMapping("/removeProductById")
//    public Result removeById(@RequestHeader String token,Long productId) throws Exception {
//        // 获取商家id
//        //String userId = JwtUtil.parseToken(token).get("userId").toString();
//        //假设有接口可以通过商家id获取店铺id
//        String storeId="1";
//        productService.removeProductById(storeId,productId);
//        return Result.getResult().setCode(200).setMsg("删除成功");
//    }
}

